package com.cskaoyan.day1.generic6;

/**
 * @author Common-zhou
 * @since 2023-02-27 15:06
 */
public class Generic5 {
    public static void main(String[] args) {
        Number number = new Integer(10);
        System.out.println(number.intValue());

        User1<Number> user1 = new User1<>();
        user1.setData(10);
        // User1<Number> user1

        Generic5 generic5 = new Generic5();
        System.out.println(generic5.compute(user1));

        User1<Integer> user11 = new User1<>();
        user11.setData(16);
        System.out.println(generic5.compute(user11));

    }

    /**
     * 想接收 Number 及Number的子类
     *
     * @param user1
     * @return
     */
    public double compute(User1<? extends Number> user1) {
        return user1.getData().doubleValue() + 1;
    }


}
